package com.jiazhong.basic.pack0315.demo;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.TreeSet;

public class DemoD {
    public static void main(String[] args) {
        HashSet<Integer> set1 = new HashSet<>();
        LinkedHashSet<Integer> set2 = new LinkedHashSet<>();
        TreeSet<Integer> set3 = new TreeSet<>();
        System.out.print("存放的内容是：");
        for (int i = 0; i < 20; i++) {
            int num = (int) (Math.random() * 100 + 1);
            set1.add(num);
            set2.add(num);
            set3.add(num);
            System.out.print(num + ",");
        }
        System.out.println("\b");
        System.out.println("HashSet:" + set1);
        System.out.println("LinkedHashSet:" + set2);
        System.out.println("TreeSet:" + set3);
    }
}
